<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="text" v-model="message" @keyup.enter="test">
        <h2>{{message}}</h2>

        <input type="button" value="修改message" @click="change">
    </div>
    <!-- 1.v-model指令的作用是：便捷的设置和获取表单元素的值
    2.绑定的数据会和表单元素值相关联
    3.绑定的数据<--->表单元素的值 -->
    <script>
        var app = new Vue({
            el:'#app',
            data:{
                message:'你好啊'
            },
            methods:{
                test:function(){
                    alert(this.message)
                },
                change:function(){
                    this.message = "我不好"
                }
            }
        })
    </script>
</body>
</html>